package com.chat.io;

import javafx.scene.control.Button;
import javafx.stage.FileChooser;

import java.io.File;

/*
  选择文件的工具类
 */
public class SelectFile {
    public File select(Button Return){
        File file=null;
        FileChooser chooser=new FileChooser();
        chooser.setInitialDirectory(new File("D:\\chatproject\\headimage"));
        chooser.setTitle("选择文件");
        file=chooser.showOpenDialog(Return.getScene().getWindow());
        if(file==null){
            System.out.println("未选择");
        }
        else{
            System.out.println("成功选择");
        }
        return file;
    }
}
